<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title th:text="${component.name}"></title>
    <script type="text/javascript" th:src="@{/js/jquery-1.8.2.min.js}"></script>
</head>
<script>
    (function () {
        try {
            var headers = [(${component.headLinks!=null&&component.headLinks.length()>0?component.headLinks:"{}"})];
            var headTag = document.getElementsByTagName("head")[0];
            for (var index in headers) {
                var header = headers[index];
                var tagname = header.tagname;

                if (tagname != "script") {
                    var element = document.createElement(tagname);
                    for (var propertyName in header.attrs) {
                        element[propertyName] = header.attrs[propertyName];
                    }
                    headTag.appendChild(element);
                } else {
                    //动态下载js 插入到head
                    $.ajax({
                        url: header.attrs.src,
                        type: "GET",
                        cache: false,
                        dataType: "Text",
                        async: false,
                        success: function (result) {
                            var script = document.createElement("script");
                            script.innerHTML = result;
                            document.getElementsByTagName("head")[0].appendChild(script);
                        },
                    });
                }
            }
        } catch (e) {
        }
    })()
</script>
<style>
    * {
        margin: 0px;
        padding: 0px;
    }

    html,
    body {
        height: 100%;
        width: 100%;
        overflow: hidden;
        background-color: Transparent;
    }

    #panel-content-container {
        height: 100%;
        width: 100%;
    }
</style>
<body>
<div id="panel-content-container">
    [(${component.htmlbody})]
</div>
<script>

    debugger
    window.onload = function () {
        debugger
        (function (container, context) {
            context.initPanel = context.initPanel || function () {
                console.warn('initPanel is null')
            }
            context.showPanels = context.showPanels || function () {
                console.warn('showPanels is null')
            }
            context.hidePanels = context.hidePanels || function () {
                console.warn('hidePanels is null')
            }
            context.getPanelOptions = function () {
                try {
                    return [(${component.customerOptions==null?"{}":component.customerOptions.values})]
                } catch (e) {
                    return null;
                }
            }
            [(${component.codes})]
        })(document.getElementById("panel-content-container"), window.parent.contextObj || {});
    }


</script>
</body>
</html>